<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学习资料 - 流光小队</title>
    <link rel="stylesheet" href="../../css/style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        .resources-section {
            max-width: 1200px;
            margin: 0 auto;
            padding: 40px 20px;
        }

        .resources-header {
            text-align: center;
            margin-bottom: 50px;
        }

        .resources-header h1 {
            font-size: 2.5em;
            color: #2d3748;
            margin-bottom: 15px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .resources-header p {
            font-size: 1.2em;
            color: #718096;
            max-width: 600px;
            margin: 0 auto;
        }

        .resources-search {
            max-width: 500px;
            margin: 0 auto 40px;
            position: relative;
        }

        .search-input {
            width: 100%;
            padding: 15px 20px;
            border: 2px solid #e2e8f0;
            border-radius: 25px;
            font-size: 1em;
            outline: none;
            transition: border-color 0.3s ease;
        }

        .search-input:focus {
            border-color: #667eea;
        }

        .search-btn {
            position: absolute;
            right: 5px;
            top: 5px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 10px 15px;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .search-btn:hover {
            transform: scale(1.05);
        }

        .resources-tabs {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-bottom: 40px;
            flex-wrap: wrap;
        }

        .tab-btn {
            padding: 12px 24px;
            border: none;
            border-radius: 25px;
            background: #f7fafc;
            color: #718096;
            font-size: 1em;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .tab-btn.active {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .tab-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
        }

        .resources-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 30px;
            margin-bottom: 50px;
        }

        .resource-card {
            background: white;
            border-radius: 16px;
            overflow: hidden;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            border: 1px solid #e2e8f0;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .resource-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
        }

        .resource-image {
            width: 100%;
            height: 180px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 3em;
            position: relative;
        }

        .resource-type {
            position: absolute;
            top: 15px;
            right: 15px;
            padding: 5px 12px;
            border-radius: 15px;
            font-size: 0.8em;
            font-weight: 600;
            color: white;
        }

        .type-book {
            background: #38a169;
        }

        .type-course {
            background: #3182ce;
        }

        .type-article {
            background: #d69e2e;
        }

        .type-video {
            background: #e53e3e;
        }

        .resource-content {
            padding: 25px;
        }

        .resource-title {
            font-size: 1.3em;
            font-weight: 600;
            color: #2d3748;
            margin-bottom: 10px;
            line-height: 1.4;
        }

        .resource-meta {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 15px;
            font-size: 0.9em;
            color: #718096;
        }

        .meta-item {
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .meta-item i {
            color: #667eea;
        }

        .resource-description {
            color: #4a5568;
            line-height: 1.6;
            margin-bottom: 20px;
        }

        .resource-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 20px;
        }

        .resource-tag {
            background: #f7fafc;
            color: #4a5568;
            padding: 4px 12px;
            border-radius: 15px;
            font-size: 0.85em;
            font-weight: 500;
        }

        .resource-stats {
            display: flex;
            justify-content: space-between;
            padding-top: 15px;
            border-top: 1px solid #e2e8f0;
        }

        .stat-item {
            text-align: center;
        }

        .stat-value {
            font-size: 1.2em;
            font-weight: 600;
            color: #667eea;
        }

        .stat-label {
            font-size: 0.8em;
            color: #718096;
            margin-top: 2px;
        }

        .resource-actions {
            display: flex;
            gap: 10px;
            margin-top: 15px;
        }

        .action-btn {
            flex: 1;
            padding: 10px 15px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            background: white;
            color: #4a5568;
            font-size: 0.9em;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            text-decoration: none;
        }

        .action-btn:hover {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        .action-btn.primary {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        .action-btn.primary:hover {
            background: #5a67d8;
        }

        .featured-resources {
            background: #f7fafc;
            border-radius: 16px;
            padding: 40px;
            margin-bottom: 50px;
        }

        .featured-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .featured-header h2 {
            font-size: 2em;
            color: #2d3748;
            margin-bottom: 10px;
        }

        .featured-header p {
            color: #718096;
            font-size: 1.1em;
        }

        .featured-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 25px;
        }

        .featured-item {
            background: white;
            border-radius: 12px;
            padding: 25px;
            text-align: center;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            transition: transform 0.3s ease;
        }

        .featured-item:hover {
            transform: translateY(-5px);
        }

        .featured-icon {
            font-size: 3em;
            color: #667eea;
            margin-bottom: 15px;
        }

        .featured-title {
            font-size: 1.2em;
            font-weight: 600;
            color: #2d3748;
            margin-bottom: 10px;
        }

        .featured-description {
            color: #718096;
            line-height: 1.5;
            margin-bottom: 15px;
        }

        .featured-btn {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .featured-btn:hover {
            transform: scale(1.05);
        }

        @media (max-width: 768px) {
            .resources-tabs {
                gap: 8px;
            }

            .tab-btn {
                padding: 10px 20px;
                font-size: 0.9em;
            }

            .resources-grid {
                grid-template-columns: 1fr;
                gap: 20px;
            }

            .featured-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <!-- 侧边栏 -->
    <div class="sidebar" id="sidebar">
        <div class="sidebar-header">
            <h3>流光小队</h3>
            <button class="sidebar-toggle" onclick="toggleSidebar()">
                <i class="fas fa-times"></i>
            </button>
        </div>
        <nav class="sidebar-nav">
            <ul>
                <li>
                    <a href="../../index.html">
                        <i class="fas fa-home"></i>
                        首页
                    </a>
                </li>
                <li>
                    <a href="../about/index.html">
                        <i class="fas fa-info-circle"></i>
                        关于我们
                    </a>
                </li>
                
                <!-- 成员相关 -->
                <li>
                    <a href="../members/index.html">
                        <i class="fas fa-users"></i>
                        成员介绍
                    </a>
                </li>
                <li>
                    <a href="../excellent/index.html">
                        <i class="fas fa-star"></i>
                        优秀成员
                    </a>
                </li>
                
                <!-- 活动相关 -->
                <li>
                    <a href="../activities/upcoming.html">
                        <i class="fas fa-calendar-alt"></i>
                        活动预告
                    </a>
                </li>
                <li>
                    <a href="../activities/past.html">
                        <i class="fas fa-history"></i>
                        往期活动
                    </a>
                </li>
                <li>
                    <a href="../activities/calendar.html">
                        <i class="fas fa-calendar"></i>
                        活动日历
                    </a>
                </li>
                
                <!-- 成果与资源 -->
                <li>
                    <a href="../achievements/index.html">
                        <i class="fas fa-trophy"></i>
                        小组成果
                    </a>
                </li>
                <li class="active">
                    <a href="index.html">
                        <i class="fas fa-book"></i>
                        学习资料
                    </a>
                </li>
                <li>
                    <a href="shares.html">
                        <i class="fas fa-share-alt"></i>
                        成员分享
                    </a>
                </li>
                
                <!-- 互动与讨论 -->
                <li>
                    <a href="../interaction/index.html">
                        <i class="fas fa-comments"></i>
                        互动交流
                    </a>
                </li>
                
                <!-- 加入与联系 -->
                <li>
                    <a href="../join/index.html">
                        <i class="fas fa-user-plus"></i>
                        加入我们
                    </a>
                </li>
                <li>
                    <a href="../contact/index.html">
                        <i class="fas fa-address-book"></i>
                        联系方式
                    </a>
                </li>
                
                <!-- 其他扩展 -->
                <li>
                    <a href="../partners/index.html">
                        <i class="fas fa-handshake"></i>
                        合作伙伴
                    </a>
                </li>
                <li>
                    <a href="../faq/index.html">
                        <i class="fas fa-question-circle"></i>
                        常见问题
                    </a>
                </li>
            </ul>
        </nav>
    </div>

    <!-- 主内容区域 -->
    <div class="main-content">
        <!-- 顶部导航栏 -->
        <div class="topbar">
            <div class="topbar-left">
                <button class="menu-toggle" onclick="toggleSidebar()">
                    <i class="fas fa-bars"></i>
                </button>
                <h1>学习资料</h1>
            </div>
        </div>

        <!-- 内容区域 -->
        <div class="content">
            <div class="resources-section">
                <!-- 页面标题 -->
                <div class="resources-header">
                    <h1>学习资料</h1>
                    <p>精选优质学习资源，助力团队成员技能提升</p>
                </div>

                <!-- 搜索框 -->
                <div class="resources-search">
                    <input type="text" class="search-input" placeholder="搜索学习资料..." id="searchInput">
                    <button class="search-btn" onclick="searchResources()">
                        <i class="fas fa-search"></i>
                    </button>
                </div>

                <!-- 资料分类标签 -->
                <div class="resources-tabs">
                    <button class="tab-btn active" onclick="switchTab('all')" data-tab="all">
                        <i class="fas fa-th"></i> 全部资料
                    </button>
                    <button class="tab-btn" onclick="switchTab('books')" data-tab="books">
                        <i class="fas fa-book"></i> 书籍推荐
                    </button>
                    <button class="tab-btn" onclick="switchTab('courses')" data-tab="courses">
                        <i class="fas fa-graduation-cap"></i> 课程课件
                    </button>
                    <button class="tab-btn" onclick="switchTab('articles')" data-tab="articles">
                        <i class="fas fa-file-alt"></i> 技术文章
                    </button>
                    <button class="tab-btn" onclick="switchTab('videos')" data-tab="videos">
                        <i class="fas fa-video"></i> 视频教程
                    </button>
                </div>

                <!-- 资料展示网格 -->
                <div class="resources-grid" id="resourcesGrid">
                    <!-- 资料卡片将通过JavaScript动态生成 -->
                </div>

                <!-- 推荐资料 -->
                <div class="featured-resources">
                    <div class="featured-header">
                        <h2><i class="fas fa-star"></i> 推荐资料</h2>
                        <p>团队成员精选的优质学习资源</p>
                    </div>
                    <div class="featured-grid">
                        <div class="featured-item">
                            <div class="featured-icon">📚</div>
                            <div class="featured-title">《深入理解计算机系统》</div>
                            <div class="featured-description">计算机系统经典教材，深入理解计算机底层原理</div>
                            <button class="featured-btn" onclick="viewResource('book1')">查看详情</button>
                        </div>
                        <div class="featured-item">
                            <div class="featured-icon">🎓</div>
                            <div class="featured-title">数据结构与算法课程</div>
                            <div class="featured-description">系统学习数据结构与算法的完整课程体系</div>
                            <button class="featured-btn" onclick="viewResource('course1')">开始学习</button>
                        </div>
                        <div class="featured-item">
                            <div class="featured-icon">📝</div>
                            <div class="featured-title">前端开发最佳实践</div>
                            <div class="featured-description">现代前端开发的技术栈和最佳实践指南</div>
                            <button class="featured-btn" onclick="viewResource('article1')">阅读文章</button>
                        </div>
                        <div class="featured-item">
                            <div class="featured-icon">🎬</div>
                            <div class="featured-title">机器学习实战教程</div>
                            <div class="featured-description">从零开始的机器学习实战视频教程</div>
                            <button class="featured-btn" onclick="viewResource('video1')">观看视频</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 资料数据
        const resources = [
            {
                id: 1,
                title: "深入理解计算机系统",
                category: "books",
                type: "book",
                author: "Randal E. Bryant",
                date: "2023-12-01",
                description: "计算机系统经典教材，深入理解计算机底层原理，包括程序结构、处理器架构、编译系统等。",
                tags: ["计算机系统", "底层原理", "经典教材"],
                icon: "📚",
                stats: { pages: 800, rating: 4.9, downloads: 5000 }
            },
            {
                id: 2,
                title: "数据结构与算法课程",
                category: "courses",
                type: "course",
                author: "张教授",
                date: "2023-11-15",
                description: "系统学习数据结构与算法的完整课程体系，包含理论讲解和实践练习。",
                tags: ["数据结构", "算法", "编程"],
                icon: "🎓",
                stats: { lessons: 24, duration: "48小时", students: 1200 }
            },
            {
                id: 3,
                title: "前端开发最佳实践",
                category: "articles",
                type: "article",
                author: "李工程师",
                date: "2023-11-20",
                description: "现代前端开发的技术栈和最佳实践指南，涵盖React、Vue、TypeScript等热门技术。",
                tags: ["前端开发", "最佳实践", "技术栈"],
                icon: "📝",
                stats: { words: 5000, views: 2500, likes: 180 }
            },
            {
                id: 4,
                title: "机器学习实战教程",
                category: "videos",
                type: "video",
                author: "王博士",
                date: "2023-11-10",
                description: "从零开始的机器学习实战视频教程，包含理论讲解和实际项目案例。",
                tags: ["机器学习", "实战教程", "AI"],
                icon: "🎬",
                stats: { episodes: 15, duration: "20小时", views: 8000 }
            },
            {
                id: 5,
                title: "Python编程从入门到精通",
                category: "books",
                type: "book",
                author: "陈老师",
                date: "2023-10-25",
                description: "Python编程语言的完整学习指南，从基础语法到高级应用。",
                tags: ["Python", "编程语言", "入门教程"],
                icon: "🐍",
                stats: { pages: 600, rating: 4.7, downloads: 3500 }
            },
            {
                id: 6,
                title: "数据库设计原理",
                category: "courses",
                type: "course",
                author: "刘教授",
                date: "2023-10-30",
                description: "数据库设计的核心原理和实践技巧，包括关系型数据库和NoSQL数据库。",
                tags: ["数据库", "设计原理", "SQL"],
                icon: "🗄️",
                stats: { lessons: 18, duration: "36小时", students: 800 }
            }
        ];

        let currentTab = 'all';
        let currentSearch = '';

        function toggleSidebar() {
            const sidebar = document.getElementById('sidebar');
            sidebar.classList.toggle('open');
        }

        function switchTab(tab) {
            currentTab = tab;
            
            // 更新标签按钮状态
            document.querySelectorAll('.tab-btn').forEach(btn => {
                btn.classList.remove('active');
            });
            document.querySelector(`[data-tab="${tab}"]`).classList.add('active');
            
            // 重新渲染资料列表
            renderResources();
        }

        function searchResources() {
            currentSearch = document.getElementById('searchInput').value.toLowerCase();
            renderResources();
        }

        function renderResources() {
            const grid = document.getElementById('resourcesGrid');
            let filteredResources = resources;
            
            // 按分类筛选
            if (currentTab !== 'all') {
                filteredResources = filteredResources.filter(resource => resource.category === currentTab);
            }
            
            // 按搜索关键词筛选
            if (currentSearch) {
                filteredResources = filteredResources.filter(resource => 
                    resource.title.toLowerCase().includes(currentSearch) ||
                    resource.description.toLowerCase().includes(currentSearch) ||
                    resource.tags.some(tag => tag.toLowerCase().includes(currentSearch))
                );
            }
            
            grid.innerHTML = filteredResources.map(resource => `
                <div class="resource-card">
                    <div class="resource-image">
                        ${resource.icon}
                        <div class="resource-type type-${resource.type}">
                            ${getTypeText(resource.type)}
                        </div>
                    </div>
                    <div class="resource-content">
                        <div class="resource-title">${resource.title}</div>
                        <div class="resource-meta">
                            <div class="meta-item">
                                <i class="fas fa-user"></i>
                                <span>${resource.author}</span>
                            </div>
                            <div class="meta-item">
                                <i class="fas fa-calendar"></i>
                                <span>${resource.date}</span>
                            </div>
                        </div>
                        <div class="resource-description">${resource.description}</div>
                        <div class="resource-tags">
                            ${resource.tags.map(tag => `<span class="resource-tag">${tag}</span>`).join('')}
                        </div>
                        <div class="resource-stats">
                            ${Object.entries(resource.stats).map(([key, value]) => `
                                <div class="stat-item">
                                    <div class="stat-value">${value}</div>
                                    <div class="stat-label">${getStatLabel(key)}</div>
                                </div>
                            `).join('')}
                        </div>
                        <div class="resource-actions">
                            <button class="action-btn" onclick="showResourceDetail(${resource.id})">
                                <i class="fas fa-eye"></i> 详情
                            </button>
                            <button class="action-btn primary" onclick="downloadResource(${resource.id})">
                                <i class="fas fa-download"></i> 下载
                            </button>
                        </div>
                    </div>
                </div>
            `).join('');
        }

        function getTypeText(type) {
            const typeMap = {
                'book': '书籍',
                'course': '课程',
                'article': '文章',
                'video': '视频'
            };
            return typeMap[type] || type;
        }

        function getStatLabel(key) {
            const labelMap = {
                'pages': '页数',
                'rating': '评分',
                'downloads': '下载',
                'lessons': '课时',
                'duration': '时长',
                'students': '学员',
                'words': '字数',
                'views': '阅读',
                'likes': '点赞',
                'episodes': '集数'
            };
            return labelMap[key] || key;
        }

        function showResourceDetail(id) {
            const resource = resources.find(r => r.id === id);
            if (resource) {
                const detailText = `
📚 资料详情

标题：${resource.title}
类型：${getTypeText(resource.type)}
作者：${resource.author}
日期：${resource.date}

📝 描述：
${resource.description}

🏷️ 标签：
${resource.tags.join('、')}

📊 统计信息：
${Object.entries(resource.stats).map(([key, value]) => `• ${getStatLabel(key)}: ${value}`).join('\n')}
                `;
                alert(detailText);
            }
        }

        function downloadResource(id) {
            const resource = resources.find(r => r.id === id);
            if (resource) {
                alert(`正在下载"${resource.title}"...\n\n📥 下载链接：https://example.com/download/${resource.id}\n\n💡 提示：请确保网络连接正常`);
            }
        }

        function viewResource(id) {
            alert(`正在跳转到"${id}"的详细页面...\n\n🔗 链接：https://example.com/resource/${id}`);
        }

        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', function() {
            renderResources();
            
            // 设置当前页面的导航项为激活状态
            document.querySelectorAll('.sidebar-nav li').forEach(li => {
                li.classList.remove('active');
            });
            document.querySelector('.sidebar-nav li:nth-child(10)').classList.add('active');
        });
    </script>
</body>
</html> 